<?php
$user_name = isset($_POST['user_name'])?strval($_POST['user_name']):'';
$phone = isset($_POST['phone'])?strval($_POST['phone']):'';
$email = isset($_POST['email'])?strval($_POST['email']):'';
$wechat = isset($_POST['wechat'])?strval($_POST['wechat']):'';
$message = isset($_POST['message'])?strval($_POST['message']):'';

if($user_name !='' || $phone !=''){
	$EmailData = array(
		'user_name' => '姓名：'.$user_name."\r\n",
		'phone' => '电话：'.$phone."\r\n",
		'email' => '邮箱：'.$email."\r\n",
		'wechat' => '微信：'.$wechat."\r\n",
		'message' => '留言：'.$message
	);
	$tring = implode('', $EmailData);
	$sendSuccess = wp_mail('455196886@qq.com','联系我们',$tring);
	if($sendSuccess){
		api_return(array(
		    'err' => 0,
		    'msg' => '信息发送成功'
		));
	}else{
		api_return(array(
		    'err' => 1,
		    'msg' => '信息发送失败'
		));
	}
}else{
	api_error(1,'请填写正确的信息');
}